package com.example.Controller;

import com.example.Service.FengShuiService;
import com.example.Service.WuhangService;
import com.example.staticlei.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/wuhang")
@RestController
@Slf4j
@CrossOrigin
public class WuhangController {
    @Autowired
    private WuhangService wuhangService;
    @GetMapping("/year")
    public Result ReturnMessage(@RequestParam String year) {
        int id = wuhangService.getMessage(year).getId();
        if (id == 0){
            return Result.fail(wuhangService.getMessage(year));
        }else {
            return Result.success(wuhangService.getMessage(year));
        }
    }
    @GetMapping("/peiou")
    public Result ReturnMessage(@RequestParam String marriage1,@RequestParam String marriage2) {
        int id = wuhangService.getPeiOuMessage(marriage1,marriage2).getId();
        if (id == 0){
            return Result.fail(wuhangService.getPeiOuMessage(marriage1,marriage2));
        }else {
            return Result.success(wuhangService.getPeiOuMessage(marriage1,marriage2));
        }
    }

}
